﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace KeshaParser
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Usage: KeshaParser.exe <path_to_source_code_file>");
                return;
            }

            Scanner scanner = new Scanner();
            Parser parser = new Parser(scanner);
            parser.ParseError += OnParserErrorEventHandler;
            Console.WriteLine("Parsing " + args[0]);
            scanner.SetText(File.ReadAllText(args[0]));
            bool instructionOk = parser.Parse();
            Console.WriteLine(instructionOk ? "KESHA" : "GOSHA");
        }

        static void OnParserErrorEventHandler(object sender, SimpleEventArgs args)
        {
            Console.WriteLine("Error: " + args.Info);
        }
    }
}
